package io.modifier.basic.compose.hooks.data

import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateMapOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.snapshots.SnapshotStateMap
import androidx.compose.runtime.toMutableStateMap

/** More convenient to use dynamic Map state **/
@Composable
fun <K, V> useMap(vararg pairs: Pair<K, V>): SnapshotStateMap<K, V> = remember {
    mutableStateMapOf(*pairs)
}

@Composable
fun <K, V> useMap(pairs: Iterable<Pair<K, V>>): SnapshotStateMap<K, V> = remember {
    pairs.toMutableStateMap()
}
